package java6681.task;

import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author Junichiro
 * @description
 * @date 2021-05-30 0:21
 **/

public class Counter6681 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入字符串:");
        String str = sc.nextLine();
        Map<String, Long> collect = Stream.of(str.split("")).
                collect(Collectors.groupingBy(String::toString, Collectors.counting()));
        Set<String> keySet = collect.keySet();
        for (String key : keySet) {
            Long aLong = collect.get(key);
            System.out.println(key + "," + aLong);
        }
    }
}
